import Vue from 'vue';
import VueRouter from 'vue-router';
import store from '../store/index';
import * as filters from '../api/filters'; //filter公共函数库
import routes from '../config/routes'
import App from '../views/app.vue'
import VueResource from 'vue-resource'
import { InfiniteScroll, Lazyload } from 'mint-ui';

import '../api/util.js'; //utiljs 自定义插件库
// import '../api/video.js';

Vue.use(VueRouter);
Vue.use(VueResource);
Vue.use(InfiniteScroll);
Vue.use(Lazyload);

// /* loading commpents */

Object.keys(filters).forEach(k => Vue.filter(k, filters[k])) //注册过滤器

// Vue.config.devtools = true;
// Vue.config.silent = false;

//路由跳转
const router = new VueRouter({
    routes,
    mode: 'history',
    base: window.location.pathname ? window.location.pathname : __dirname
})

router.beforeEach(({ path }, from, next) => {
    next()
})

//挂载首页
new Vue({ router, render: h => h(App) }).$mount('#myApp')